package com.myplans.client.view;

import com.google.gwt.core.client.GWT;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.FileUpload;
import com.google.gwt.user.client.ui.FormPanel;
import com.google.gwt.user.client.ui.HTMLPanel;
import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.TextBox;
import com.google.gwt.user.client.ui.Widget;
import com.myplans.client.presenter.ProfilePresenter.SettingsDisplay;

public class SettingsView extends Composite implements SettingsDisplay {

	private static SettingsViewUiBinder uiBinder = GWT
			.create(SettingsViewUiBinder.class);

	interface SettingsViewUiBinder extends UiBinder<Widget, SettingsView> {
	}

	public SettingsView() {
		initWidget(uiBinder.createAndBindUi(this));
	}

	@UiField
	Button save;
	@UiField
	TextBox name;
	@UiField
	TextBox username;
	@UiField
	TextBox email;
	@UiField
	FormPanel addPictureForm;
	@UiField
	FileUpload pictureUpload;
	@UiField
	Image picture;
	@UiField
	HTMLPanel picturePanel;
	
	public void setPicture(Image picture) {
		picturePanel.clear();
		this.picture = picture;
		picturePanel.add(this.picture);
	}

	public Image getPicture() {
		return picture;
	}
	
	public FormPanel getAddPictureForm() {
		return addPictureForm;
	}

	public FileUpload getPictureUpload() {
		return pictureUpload;
	}

	public SettingsView(String firstName) {
		initWidget(uiBinder.createAndBindUi(this));
	}

	public Button getSave() {
		return save;
	}

	public String getName() {
		return name.getText();
	}

	public String getUsername() {
		return username.getText();
	}

	public String getEmail() {
		return email.getText();
	}

	public void setName(String name) {
		this.name.setText(name);
	}

	public void setUsername(String username) {
		this.username.setText(username);
	}

	public void setEmail(String email) {
		this.email.setText(email);
	}

}
